<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="BIG5"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>Product Management System</title>
		<link rel="stylesheet" href="css/black-tie/jquery-ui-1.9.0.custom.css" type="text/css" />
		<link rel="stylesheet" href="css/theme1.css" type="text/css" />
		<link rel="stylesheet" href="css/style.css" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.8.2.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.9.0.custom.js"></script>
		<script type="text/javascript" src="js/common.js"></script>
	    <link rel="stylesheet" href="css/ui.jqgrid.css" type="text/css" />
	    <script src="src/i18n/grid.locale-en.js" type="text/javascript"> </script>
	    <script src="js/jquery.jqGrid.min.js" type="text/javascript"> </script>
</head>
<body>
	<jsp:include page="sections/header.jsp" />
	<div id="main">
		<div id="container">
			<div id="datagrid">
			    <table id="list2"></table>
	    		<div id="pager2"></div>
			</div>
			<fieldset id="actionpanel">
				<legend>What to do?</legend>
				<a id="ClrButt" class="actionButt" type="button">Clear</a>
				<a href='productAddition.jsp' id="AddButt" class="actionButt" type="button">Add</a>
				<a href='productEditServlet' id="EditButt" class="actionButt" type="button">Edit</a>
				<a href='productDeleteServlet' id="DelButt" class="actionButt" type="button">Delete</a>
			</fieldset>
		</div>
	</div>
    <script>
        onload = function() {
            $("#list2").jqGrid({
                datatype: "local",
                width: 1100,
                height: 300,
                colNames: ['Item Number', 'Product', 'Category', 'Brand', 'Supplier', 'Spec1', 'Spec2', 'Spec3', 'Spec4', 'Spec5', 'Spec6', 'Spec7', 'Description', 'Price', 'Discount', 'Stock', 'Sold'],
                colModel: [
                    { name: 'id', index: 'id', width: 50 },
                    { name: 'productname', index: 'productname', width: 50 },
                    { name: 'category', index: 'category', width: 50 },
                    { name: 'brand', index: 'brand', width: 50 },
                    { name: 'supplier', index: 'supplier', width: 50 },
                    { name: 'spec1', index: 'spec1', width: 50 },
                    { name: 'spec2', index: 'spec1', width: 50 },
                    { name: 'spec3', index: 'spec1', width: 50 },
                    { name: 'spec4', index: 'spec1', width: 50 },
                    { name: 'spec5', index: 'spec1', width: 50 },
                    { name: 'spec6', index: 'spec1', width: 50 },
                    { name: 'spec7', index: 'spec1', width: 50 },
                    { name: 'desc', index: 'desc', width: 50 },
                    { name: 'price', index: 'price', width: 50 },
                    { name: 'discount', index: 'discount', width: 50 },
                    { name: 'stock', index: 'stock', width: 50 },
                    { name: 'sold', index: 'sold', width: 50 }
                ],
                rowNum: 10,
                rowList: [10, 20, 30],
                pager: '#pager2',
                sortname: 'id',
                viewrecords: true,
                sortorder: "desc",
                caption: "Product Inventory"
            });
            $("#list2").jqGrid('navGrid', '#pager2', { edit: false, add: false, del: false });
            var mydata = [            
            {id:"1",productname:"Product1",category:"category1",brand:"brand1",supplier:"supplier1",spec1:"spec1",spec2:"",spec3:"",spec4:"",spec5:"",spec6:"",spec7:"",desc:"description1",price:"10",discount:"100",stock:"10",sold:"10"},
            {id:"2",productname:"product2",category:"category2",brand:"brand2",supplier:"supplier2",spec1:"spec2",spec2:"",spec3:"",spec4:"",spec5:"",spec6:"",spec7:"",desc:"description2",price:"20",discount:"100",stock:"20",sold:"20"},
            {id:"10",productname:"iPhone 5",category:"Smart Phone",brand:"Apple",supplier:"AT&T",spec1:"A6 chip",spec2:"4-inch (diagonal) Retina display",spec3:"8-megapixel iSight camera",spec4:"Built-in rechargeable lithium-ion battery",spec5:"1080p HD video recording",spec6:"Lightning Connector",spec7:"Nano-SIM",desc:"iPhone 5",price:"4999",discount:"100",stock:"20",sold:"10495"},
            {id:"11",productname:"Nexus One",category:"Smart Phone",brand:"Google",supplier:"CTM",spec1:"Qualcomm Snapdragon QSD8250",spec2:"512 MB Memony",spec3:"512 MB Storage",spec4:"1400 mAh Internal Battery",spec5:" SuperLCD 3.7 in (94 mm) diagonal PenTile",spec6:"5.0 megapixel with 2X digital zoom",spec7:"Android 2.1 Eclair",desc:"Nexus One",price:"3800",discount:"100",stock:"20",sold:"4391"},
            {id:"12",productname:"iPhone",category:"Smart Phone",brand:"Apple",supplier:"AT&T",spec1:"ARM 1176JZ(F)-S",spec2:"PowerVR MBX Lite 3D",spec3:"128 MB DRAM",spec4:"1400 mAh Internal Battery",spec5:"4/8/16 Storage",spec6:"2.0 Megapixel",spec7:"Built-in Battery",desc:"Nexus One",price:"3800",discount:"100",stock:"20",sold:"4391"},
            {id:"13",productname:"Nexus 4",category:"Smart Phone",brand:"Google",supplier:"CTM",spec1:"Qualcomm Snapdragon S4 Pro APQ8064",spec2:"PowerVR MBX Lite 3D",spec3:"2048 MB RAM",spec4:"2100 mAh Battery",spec5:"4/8/16 Storage",spec6:"8 megapixels camera",spec7:"IPS LCD",desc:"Nexus One",price:"3800",discount:"100",stock:"20",sold:"4391"},
            {id:"14",productname:"Nexus 7",category:"Smart Phone",brand:"Google",supplier:"CTM",spec1:"NVIDIA Tegra 3",spec2:"7.00 inches size",spec3:"1024 MB RAM",spec4:"2100 mAh Battery",spec5:"16/32GB Storage",spec6:"ULP GeForce @ 416MHz",spec7:"IPS LCD",desc:"Nexus 7",price:"1600",discount:"100",stock:"32768",sold:"39"},
            {id:"15",productname:"Nexus 10",category:"Smart Tablet",brand:"Google",supplier:"Google",spec1:"1.7GHz Samsung Exynos 5",spec2:"10.05 inches size",spec3:"2048 MB RAM",spec4:"9000 mAh Battery",spec5:"16/32GB Storage",spec6:"ULP GeForce @ 416MHz",spec7:"Light sensor, Scratch-resistant glass",desc:"Nexus 10",price:"3200",discount:"100",stock:"3918",sold:"14"},
            {id:"16",productname:"One X+",category:"Smart Phone",brand:"HTC",supplier:"CSL",spec1:"1.7GHz NVIDIA Tegra3",spec2:"ULP GeForce @ 520MHz",spec3:"1024 MB RAM Memory",spec4:"64 GB Built-in storage",spec5:"4.7 inches size",spec6:"8 megapixels camera",spec7:"2100 mAh Battery",desc:"One X+",price:"4100",discount:"100",stock:"68492",sold:"769"},
            {id:"17",productname:"PowerShot G15",category:"Camera",brand:"Canon",supplier:"Canon",spec1:"12-megapixel CMOS sensor",spec2:"Canon DIGIC 5 Image Processor",spec3:"ISO 12800",spec4:"1080p Full HD video in stereo sound",spec5:"Bright 3.0-inch LCD",spec6:"",spec7:"",desc:"PowerShot G15",price:"4000",discount:"100",stock:"68492",sold:"769"},
            {id:"18",productname:"Windows 8 Surface Pro",category:"Computer",brand:"Microsoft",supplier:"Microsoft",spec1:"Intel Core i5 (Ivy Bridge)",spec2:"10.60 inches size",spec3:"4096 MB RAM",spec4:"64 GB Built-in storage",spec5:"1920x1080 (1080p HD) Camera",spec6:"Intel HD Graphics 4000",spec7:"",desc:"Windows 8 Surface Pro",price:"8000",discount:"100",stock:"45612",sold:"8969"},
            {id:"19",productname:"EOS-M",category:"Camera",brand:"Canon",supplier:"Canon",spec1:"18.5-megapixel CMOS sensor",spec2:"Canon DIGIC 5 Image Processor",spec3:"ISO 12800",spec4:"1080p Full HD video in stereo sound",spec5:"Bright 3.0-inch LCD",spec6:"",spec7:"",desc:"EOS Series",price:"6000",discount:"100",stock:"6892",sold:"769"},
            {id:"20",productname:"Surface RT",category:"Computer",brand:"Microsoft",supplier:"Microsoft",spec1:"nVIDIA T30 (ARM)",spec2:"10.60 inches size",spec3:"2048 MB RAM",spec4:"32 GB Built-in storage",spec5:"1366x768 (720p HD)",spec6:"nVIDIA T30 (ARM)",spec7:"",desc:"Windows 8 RT",price:"3500",discount:"100",stock:"25602",sold:"368"},
            {id:"21",productname:"Windows 8 Surface Pro",category:"Computer",brand:"Microsoft",supplier:"Microsoft",spec1:"Intel Core i5 (Ivy Bridge)",spec2:"10.60 inches size",spec3:"4096 MB RAM",spec4:"128 GB Built-in storage",spec5:"1920x1080 (1080p HD) Camera",spec6:"Intel HD Graphics 4000",spec7:"",desc:"Windows 8 Surface Pro",price:"9800",discount:"100",stock:"75613",sold:"8067"},
            ];
            for(var i=0;i<=mydata.length;i++)
                jQuery("#list2").jqGrid('addRowData',i+1,mydata[i]);
            }
     </script>
</body>
</html>